
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>集成配置中心 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="passport.html" />
    
    
    <link rel="prev" href="../integration.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    概要
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1.1" data-path="../architecture.html">
            
                <a href="../architecture.html">
            
                    
                    总体架构
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../quick-start.html">
            
                <a href="../quick-start.html">
            
                    
                    快速开始
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../quickstart/confcenter.html">
            
                <a href="../quickstart/confcenter.html">
            
                    
                    配置中心
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../quickstart/oneplatform.html">
            
                <a href="../quickstart/oneplatform.html">
            
                    
                    oneplatform企业级开发平台
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../quickstart/passport.html">
            
                <a href="../quickstart/passport.html">
            
                    
                    统一认证平台
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../jeesuite-lib.html">
            
                <a href="../jeesuite-lib.html">
            
                    
                    jeesuite-libs使用文档
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../jeesuite-libs/common.html">
            
                <a href="../jeesuite-libs/common.html">
            
                    
                    common模块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../jeesuite-libs/common2.html">
            
                <a href="../jeesuite-libs/common2.html">
            
                    
                    common2模块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../jeesuite-libs/spring.html">
            
                <a href="../jeesuite-libs/spring.html">
            
                    
                    Spring模块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../jeesuite-libs/mybatis.html">
            
                <a href="../jeesuite-libs/mybatis.html">
            
                    
                    mybatis模块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="../jeesuite-libs/cache.html">
            
                <a href="../jeesuite-libs/cache.html">
            
                    
                    cache模块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.6" data-path="../jeesuite-libs/kafka.html">
            
                <a href="../jeesuite-libs/kafka.html">
            
                    
                    kafka模块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.7" data-path="../jeesuite-libs/scheduler.html">
            
                <a href="../jeesuite-libs/scheduler.html">
            
                    
                    scheduler模块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.8" data-path="../jeesuite-libs/filesystem.html">
            
                <a href="../jeesuite-libs/filesystem.html">
            
                    
                    filesystem模块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.9" data-path="../jeesuite-libs/rest.html">
            
                <a href="../jeesuite-libs/rest.html">
            
                    
                    restAPI模块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.10" data-path="../jeesuite-libs/springboot-starter.html">
            
                <a href="../jeesuite-libs/springboot-starter.html">
            
                    
                    springboot-starter模块
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../integration.html">
            
                <a href="../integration.html">
            
                    
                    系统集成
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter active" data-level="1.4.1" data-path="confcenter.html">
            
                <a href="confcenter.html">
            
                    
                    集成配置中心
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="passport.html">
            
                <a href="passport.html">
            
                    
                    集成认证中心
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../base-env-install.html">
            
                <a href="../base-env-install.html">
            
                    
                    附：基础环境搭建
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >集成配置中心</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h2 id="&#x4ECB;&#x7ECD;">&#x4ECB;&#x7ECD;</h2>
<p>&#x914D;&#x7F6E;&#x4E2D;&#x5FC3;&#x63D0;&#x4F9B;&#x5E94;&#x7528;&#x7BA1;&#x7406;&#xFF0C;&#x914D;&#x7F6E;&#x7EDF;&#x4E00;&#x7BA1;&#x7406;&#xFF0C;&#x5E94;&#x7528;&#x76D1;&#x63A7;&#x7B49;&#x3002;</p>
<h2 id="&#x4F7F;&#x7528;&#x8BF4;&#x660E;">&#x4F7F;&#x7528;&#x8BF4;&#x660E;</h2>
<h3 id="&#x6DFB;&#x52A0;&#x4F9D;&#x8D56;">&#x6DFB;&#x52A0;&#x4F9D;&#x8D56;</h3>
<pre><code>&lt;dependency&gt;
  &lt;groupId&gt;com.jeesuite&lt;/groupId&gt;
  &lt;artifactId&gt;jeesuite-config-client&lt;/artifactId&gt;
 &lt;version&gt;1.1.5&lt;/version&gt;
&lt;/dependency&gt;
</code></pre><h3 id="&#x6DFB;&#x52A0;&#x914D;&#x7F6E;">&#x6DFB;&#x52A0;&#x914D;&#x7F6E;</h3>
<p>&#x666E;&#x901A;&#x9879;&#x76EE;&#x6DFB;&#x52A0;&#x5728;<code>confcenter.properties</code>,springboot&#x9879;&#x76EE;&#x6DFB;&#x52A0;&#x5728;<code>application.properties</code></p>
<pre><code>#&#x662F;&#x5426;&#x542F;&#x7528;&#x914D;&#x7F6E;&#x4E2D;&#x5FC3;&#xFF0C;&#x9ED8;&#x8BA4;&#xFF1A;true
jeesuite.configcenter.enabled=false
#&#x5E94;&#x7528;&#x540D;&#xFF0C;springboot&#x9ED8;&#x8BA4;&#xFF1A;${spring.application.name}
jeesuite.configcenter.appName=passport
jeesuite.configcenter.base.url=http://configserver:7777
#&#x5F53;&#x524D;&#x73AF;&#x5883;
jeesuite.configcenter.profile=dev
#&#x540C;&#x6B65;&#x65B9;&#x5F0F;&#xFF0C;&#x9ED8;&#x8BA4;:http
jeesuite.configcenter.sync-type=zookeeper
# &#x540C;&#x6B65;&#x95F4;&#x9694;&#xFF0C;&#x540C;&#x6B65;&#x65B9;&#x5F0F;&#x4E3A;&#xFF1A;http&#x65F6;&#x751F;&#x6548;
jeesuite.configcenter.sync-interval-seconds=30
# &#x5982;&#x679C;&#x9700;&#x8981;&#x5BF9;&#x914D;&#x7F6E;RSA&#x52A0;&#x5BC6;&#xFF0C;&#x5219;&#x914D;&#x7F6E;&#x4EE5;&#x4E0B;&#x5185;&#x5BB9;&#xFF0C;&#x8BC1;&#x4E66;&#x9700;&#x8981;&#x63D0;&#x524D;&#x751F;&#x6210;
jeesuite.configcenter.encrypt-keyStore-location=classpath:private.jks
jeesuite.configcenter.encrypt-keyStore-password=123456
jeesuite.configcenter.encrypt-keyStore-type=JCEKS
jeesuite.configcenter.encrypt-keyStore-alias=demo
jeesuite.configcenter.encrypt-keyStore-keyPassword=123456
</code></pre><h3 id="&#x901A;&#x8FC7;jvm&#x53C2;&#x6570;&#x5916;&#x90E8;&#x8BBE;&#x7F6E;&#x914D;&#x7F6E;">&#x901A;&#x8FC7;JVM&#x53C2;&#x6570;&#x5916;&#x90E8;&#x8BBE;&#x7F6E;&#x914D;&#x7F6E;</h3>
<pre><code>-Djeesuite.configcenter.profile=dev
-Djeesuite.configcenter.encrypt-keyStore-location=/Users/jiangwei/private.jks
-Djeesuite.configcenter.encrypt-keyStore-password=123456
-Djeesuite.configcenter.encrypt-keyStore-alias=demo
-Djeesuite.configcenter.encrypt-keyStore-keyPassword=123456
</code></pre><h3 id="docker&#x5916;&#x90E8;&#x8BBE;&#x7F6E;&#x914D;&#x7F6E;">docker&#x5916;&#x90E8;&#x8BBE;&#x7F6E;&#x914D;&#x7F6E;</h3>
<pre><code>-e jeesuite.configcenter.profile=&quot;dev&quot;
-e jeesuite.configcenter.encrypt-keyStore-location=&quot;/Users/jiangwei/private.jks&quot;
-e jeesuite.configcenter.encrypt-keyStore-password=&quot;123456&quot;
-e jeesuite.configcenter.encrypt-keyStore-alias=&quot;demo&quot;
-e jeesuite.configcenter.encrypt-keyStore-keyPassword=&quot;123456&quot;
</code></pre><h3 id="&#x914D;&#x7F6E;&#x4E2D;&#x5FC3;&#x65B0;&#x589E;&#x914D;&#x7F6E;">&#x914D;&#x7F6E;&#x4E2D;&#x5FC3;&#x65B0;&#x589E;&#x914D;&#x7F6E;</h3>
<ol>
<li>&#x767B;&#x5F55;<a href="http://${configserver}:7777" target="_blank">http://${configserver}:7777(&#x5F00;&#x53D1;&#x73AF;&#x5883;)</a>&#xFF0C;&#x9ED8;&#x8BA4;&#x7BA1;&#x7406;&#x5458;&#x8D26;&#x53F7;&#x5BC6;&#x7801;&#xFF1A;<em><strong>admin/admin123</strong></em>&#x3002;</li>
<li>&#x65B0;&#x589E;&#x5E94;&#x7528;</li>
<li>&#x65B0;&#x589E;&#x5BF9;&#x5E94;&#x5E94;&#x7528;&#x53CA;&#x73AF;&#x5883;&#x914D;&#x7F6E;</li>
</ol>
<pre><code>http://${configserver}:7777/api/fetch_all_configs?appName=${jeesuite.configcenter.appName}&amp;env=dev&amp;version=0.0.0
</code></pre><h3 id="&#x666E;&#x901A;spring&#x9879;&#x76EE;&#x914D;&#x7F6E;xml">&#x666E;&#x901A;spring&#x9879;&#x76EE;&#x914D;&#x7F6E;xml</h3>
<ol>
<li>&#x53BB;&#x6389;&#x539F;&#x52A0;&#x8F7D;&#x914D;&#x7F6E;&#x76F8;&#x5173;&#x914D;&#x7F6E;</li>
<li>&#x65B0;&#x589E;&#x914D;&#x7F6E;</li>
</ol>
<pre><code class="lang-xml"><span class="hljs-tag">&lt;<span class="hljs-name">bean</span> <span class="hljs-attr">class</span>=<span class="hljs-string">&quot;com.jeesuite.confcenter.spring.CCPropertyPlaceholderConfigurer&quot;</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">property</span> <span class="hljs-attr">name</span>=<span class="hljs-string">&quot;remoteEnabled&quot;</span> <span class="hljs-attr">value</span>=<span class="hljs-string">&quot;true&quot;</span> /&gt;</span>
    <span class="hljs-comment">&lt;!-- &#x672C;&#x5730;&#x914D;&#x7F6E;&#x6587;&#x4EF6;&#xFF0C;&#x65E0;&#x672C;&#x5730;&#x914D;&#x7F6E;&#x53EF;&#x4E0D;&#x914D;&#x7F6E; --&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">property</span> <span class="hljs-attr">name</span>=<span class="hljs-string">&quot;locations&quot;</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">list</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">value</span>&gt;</span>classpath*:application.properties<span class="hljs-tag">&lt;/<span class="hljs-name">value</span>&gt;</span>
      <span class="hljs-tag">&lt;/<span class="hljs-name">list</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">property</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">bean</span>&gt;</span>
</code></pre>
<h3 id="&#x914D;&#x7F6E;&#x4F18;&#x5148;&#x7EA7;">&#x914D;&#x7F6E;&#x4F18;&#x5148;&#x7EA7;</h3>
<ol>
<li>&#x5E94;&#x7528;&#x672C;&#x5730;&#x914D;&#x7F6E; &gt; &#x8FDC;&#x7A0B;&#x5E94;&#x7528;&#x914D;&#x7F6E; &gt; &#x8FDC;&#x7A0B;&#x5168;&#x5C40;&#x914D;&#x7F6E;</li>
<li>&#x914D;&#x7F6E;&#x4E2D;&#x5FC3;&#x914D;&#x7F6E;<code>jeesuite.configcenter.remote-config-first=true</code>&#x53EF;&#x4EE5;&#x542F;&#x7528;&#x8FDC;&#x7A0B;&#x914D;&#x7F6E;&#x8986;&#x76D6;&#x672C;&#x5730;&#x914D;&#x7F6E;</li>
</ol>
<h3 id="&#x914D;&#x7F6E;&#x5B9E;&#x65F6;&#x751F;&#x6548;">&#x914D;&#x7F6E;&#x5B9E;&#x65F6;&#x751F;&#x6548;</h3>
<p>&#x914D;&#x7F6E;&#x53D8;&#x66F4;&#x540E;&#x4F1A;&#x5B9E;&#x65F6;&#x4E0B;&#x53D1;&#x5230;&#x5E94;&#x7528;&#xFF0C;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x4EE5;&#x4E0B;&#x65B9;&#x5F0F;&#x5B9E;&#x65F6;&#x8BFB;&#x53D6;&#x6700;&#x65B0;&#x914D;&#x7F6E;  </p>
<ol>
<li>&#x5728;&#x4EE3;&#x7801;&#x4E2D;&#x4F7F;&#x7528;<code>ResourceUtils</code>&#x5B9E;&#x65F6;&#x8BFB;&#x53D6;  </li>
<li>&#x4F9D;&#x8D56;&#x6CE8;&#x5165;<code>Environment</code>&#xFF0C;&#x5728;&#x4EE3;&#x7801;&#x4E2D;&#x5B9E;&#x65F6;&#x8BFB;&#x53D6;  </li>
<li>&#x5B9E;&#x73B0;<code>ConfigChangeHanlder</code>&#x63A5;&#x53E3;&#xFF0C;&#x81EA;&#x5B9A;&#x4E49;&#x5237;&#x65B0;&#x903B;&#x8F91;</li>
</ol>
<hr>
<pre><code class="lang-java"><span class="hljs-meta">@Controller</span>  
<span class="hljs-meta">@RequestMapping</span>(value = <span class="hljs-string">&quot;/sms&quot;</span>)
<span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">AuthCommonController</span> <span class="hljs-keyword">implements</span> <span class="hljs-title">ConfigChangeHanlder</span></span>{

    <span class="hljs-meta">@Value</span>(<span class="hljs-string">&quot;${sms.send.open}&quot;</span>)
    <span class="hljs-keyword">private</span> <span class="hljs-keyword">boolean</span> open = <span class="hljs-keyword">false</span>;


    <span class="hljs-meta">@Override</span>
    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">onConfigChanged</span><span class="hljs-params">(Map&lt;String, Object&gt; changedConfigs)</span> </span>{
        <span class="hljs-keyword">if</span>(changedConfigs.containsKey(<span class="hljs-string">&quot;sms.send.open&quot;</span>)){
            open = Boolean.parseBoolean(changedConfigs.get(<span class="hljs-string">&quot;sms.send.open&quot;</span>).toString());
        }
    }
}
</code></pre>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="../integration.html" class="navigation navigation-prev " aria-label="Previous page: 系统集成">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="passport.html" class="navigation navigation-next " aria-label="Next page: 集成认证中心">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"集成配置中心","level":"1.4.1","depth":2,"next":{"title":"集成认证中心","level":"1.4.2","depth":2,"path":"integration/passport.md","ref":"integration/passport.md","articles":[]},"previous":{"title":"系统集成","level":"1.4","depth":1,"path":"integration.md","ref":"integration.md","articles":[{"title":"集成配置中心","level":"1.4.1","depth":2,"path":"integration/confcenter.md","ref":"integration/confcenter.md","articles":[]},{"title":"集成认证中心","level":"1.4.2","depth":2,"path":"integration/passport.md","ref":"integration/passport.md","articles":[]}]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":[],"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"integration/confcenter.md","mtime":"2018-05-04T09:39:56.771Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-05-04T10:30:11.187Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

